package io.wdb.wxapp.model;

import java.io.Serializable;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;

import io.swagger.annotations.ApiModelProperty;

import io.wdb.modules.activity.wxapp.entity.HdConfigEntity;


/**
 * 伴读记录
 * 
 * @author wdb
 * @email xulin@wdb007.com
 * @date 2018-01-20 15:11:02
 */
public class HdConfigModel implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@ApiModelProperty(value = "配置文件key", required = true)
	private String hdKey;
	@ApiModelProperty(value = "配置文件Value", required = true)
	private String hdValue;

	/**
	 * 设置：配置文件key
	 */
	public void setHdKey(String hdKey) {
		this.hdKey = hdKey;
	}
	/**
	 * 获取：配置文件key
	 */
	public String getHdKey() {
		return hdKey;
	}
	/**
	 * 设置：配置文件Value
	 */
	public void setHdValue(String hdValue) {
		this.hdValue = hdValue;
	}
	/**
	 * 获取：配置文件Value
	 */
	public String getHdValue() {
		return hdValue;
	}

    public static HdConfigModel convert(HdConfigEntity entity) {
		if(entity == null) {
			return null;
		}
		HdConfigModel model = new HdConfigModel();
				model.setHdKey(entity.getHdKey());
				model.setHdValue(entity.getHdValue());
				
		return model;
	}
	public static List<HdConfigModel> convert(List<HdConfigEntity> entities){
		if(entities == null || entities.isEmpty()) {
			return null;
		}
		List<HdConfigModel> models = new ArrayList<>();
		
		for(HdConfigEntity entity:entities) {
			models.add(convert(entity));
		}
		
		return models;
	}
	
	public static HdConfigEntity convert(HdConfigModel model) {
		if(model == null) {
			return null;
		}
		HdConfigEntity entity = new HdConfigEntity();
				entity.setHdKey(model.getHdKey());
				entity.setHdValue(model.getHdValue());
				
		return entity;
	}

}
